import HttpKit from '@/utils/http-kit'

export default {
  /**
   * @description 返回合同列表
   * @returns {constractList}
   */
  getContractList () {
    return HttpKit.get('/contractMsgs', {pageNumber: '0', pageSize: '10000'}).then(
      res => res.data
    )
  },
  /**
   * @description 删除合同
   * @param contractId 要删除的合同的编号
   * @returns {Promise<T | never>}
   */
  deleteContract (contractId) {
    return HttpKit.delete('/contract/delete/' + contractId, {}).then(
      res => res
    )
  },
  /**
   * @description 得到特定用户的合同表
   * @param customerId 用户ID
   * @returns {Promise<T | never>}
   */
  getCustomerContractList (customerId) {
    return HttpKit.get('contractMsgs/customerId/' + customerId, {pageNumber: '0', pageSize: '10000'}).then(
      res => res.data
    )
  },
  /**
   * @description 业务员查看合同列表
   * @param sellId
   * @returns {Promise<T | never>}
   */
  getSalesmanContractList (sellId) {
    return HttpKit.get('contractMsgs/sellId/' + sellId, {pageNumber: '0', pageSize: '10000'}).then(
      res => res.data
    )
  }
}
